import java.util.Random;

public class speedChecker {
    public static void measureSpeed(double speed) throws overSpeed {
        if(speed > 120)
        {
            throw new overSpeed("你已经超速!");
        }
    }

    public static void main(String[] args) {
        Random random = new Random();
        while(true)
        {
            double speed = random.nextDouble() * 200;
            System.out.println("速度是:" + speed + "km/h");
            try
            {
                measureSpeed(speed);
            }catch (overSpeed e)
            {
                System.out.println(e.getMessage());
            }
        }
    }
}
